In C# how can I serialize a List<int> to a byte[] in order to store it in a DB field?
Posted
by Matt
on Stack Overflow
See other posts from Stack Overflow
or by Matt
Published on 2010-03-26T18:38:10Z
Indexed on
2010/03/26
18:43 UTC
Read the original article
Hit count: 220
In C# how can I serialize a List to a byte[] in order to store it in a DB field?
I know how to serialize to a file on the disk, but how do I just serialize to a variable?
Here is how I serialized to the disk:
List<int> l = IenumerableofInts.ToList();
Stream s = File.OpenWrite("file.bin");
BinaryFormatter bf = new BinaryFormatter();
bf.Serialize(s, lR);
s.Close();
I'm sure it's much the same but I just can't wrap my head around it.
© Stack Overflow or respective owner